package org.jaaksi.kottlindemo.home

import android.widget.Toast
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.ProcessLifecycleOwner
import org.jaaksi.kottlindemo.LibConfig
import timber.log.Timber

object MyLifecycleObserver : LifecycleObserver {

    fun initLifecycle() {
        ProcessLifecycleOwner.get().lifecycle.addObserver(this)
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    fun onAppOnStart() {
//        Toast.makeText(LibConfig.applicationContext, "app回到前台", Toast.LENGTH_SHORT).show()
        Timber.e("app回到前台:topActivity = ${AppLifecycleCallbacks.topActivity}")
//        if (AppLifecycleCallbacks.topActivity !is SplashActivity){
//            SplashActivity.start(AppLifecycleCallbacks.topActivity!!)
//        }

    }
}